if (!require("renv")) {
  install.packages("renv")
  library(renv)
}

if (!require("tinytex")) {
  install.packages("tinytex")
  library(tinytex)
}

# For R VSCode

if (!require("jsonlite")) {
  install.packages("jsonlite")
  library(jsonlite)
}

# if (!require("languageserver")) {
#   install.packages("languageserver")
#   library(languageserver)
# }

# if (!require("httpgd")) {
#   install.packages("httpgd")
#   library(httpgd)
# }


# Tidyverse

if (!require("dplyr")) {
  install.packages("dplyr")
  library(dplyr)
}

if (!require("tidyr")) {
  install.packages("tidyr")
  library(tidyr)
}

if (!require("forcats")) {
  install.packages("forcats")
  library(forcats)
}

if (!require("purrr")) {
  install.packages("purrr")
  library(purrr)
}

if (!require("readr")) {
  install.packages("readr")
  library(readr)
}

if (!require("tibble")) {
  install.packages("tibble")
  library(tibble)
}

if (!require("ggplot2")) {
  install.packages("ggplot2")
  library(ggplot2)
}

if (!require("haven")) {
  install.packages("haven")
  library(haven)
}

if (!require("modelsummary")) {
  install.packages("modelsummary")
  library(modelsummary)
}

# if (!require("gtsummary")) {
#   install.packages("gtsummary")
#   library(gtsummary)
# }

if (!require("gapclosing")) {
  install.packages("gapclosing")
  library(gapclosing)
}

if (!require("MetBrewer")) {
  install.packages("MetBrewer")
  library(MetBrewer)
}

if (!require("gghighlight")) {
  install.packages("gghighlight")
  library(gghighlight)
}

# Multiple Imputation ----

if (!require("mice")) {
  install.packages("mice")
  library(mice)
}

if (!require("naniar")) {
  install.packages("naniar")
  library(naniar)
}


# install.packages("Amelia")
library(Amelia)


# Load the packages

# if (!require("ggpubr")) {
#   install.packages("ggpubr")
#   library(ggpubr)
# }

# install.packages("ggpubr", repos = "https://cloud.r-project.org/", dependencies = TRUE)
